package com.zsw.rpc;

import com.zsw.entity.Commodity;
import feign.FeignException;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author zhangsw
 */
@FeignClient(name = "commodity-service")
@Component
public interface CommodityFeignClient {
    /**
     * 远程调用
     * @param commodity
     * @return
     * @throws FeignException
     */
    @PostMapping(value = "/commodity/add")
    Boolean addCommodityById(Commodity commodity) throws FeignException;

    /**
     * 远程调用
     * @param id
     * @return
     * @throws FeignException
     */
    @GetMapping(value = "/commodity/get")
    Commodity getCommodityById(@RequestParam("id") Integer id) throws FeignException;
}

